Before the advent of computers, many methods were developed for encrypting plain text into ciphertext so that a party having the appropriate key could decrypt the message to view the plain text. The methods were typically executed by humans with pen and paper and were later adapted for use with telegraph and teletype.
If the key used for encryption and decryption is as long as the message, it is referred to as a “one-time-pad” (OTP) encryption method and if the key is shorter than the message, such that the key, or a derivative of the key, must be used two or more times, it is referred to as a “repeating key” encryption method.
When computers were first developed, memory for storage of encryption keys was expensive and difficult to handle. The key for one-time pad encryption key needs to be as long as the message and must be used only once. Consequently, repeating keys were favored over one-time-pad keys because they are much smaller, typically hundreds or thousands of times smaller and can be reused. A popular repeating key method, known as public key encryption, uses different but related public and private keys for encryption and decryption.
Given a large enough sample of encrypted messages and a fast enough computer with a large enough memory, any repeating key encryption can be broken. With the recent increases in computer speed and memory size, repeating key encryption methods previously thought to provide adequate security have been broken. The only known encryption method that is provably unbreakable is one-time-pad.
The original form of one-time-pad encryption was performed using a key consisting of a random sequence of the 26 letters of the alphabet and the 10 numerals and little or no punctuation. The message was limited to the same character set as the key. To explain how it works, we assume a character set of 38 characters. If we assign to each character a value ranging from zero to 37, the encryption process can be performed by combining the first character of the message with the first character of the random key and then the second character of the message with the second character of the key, and so on. The combination process can be either addition or subtraction of the character values in base 38 (modulo 38) discarding the carry, and the decryption process is the opposite. Thus, the sum of value 35 plus the value 5 produces the value 2. Likewise, the value 2 minus the value 5 is the value 35. Such a one-time-pad encryption process can be performed with any number of characters in a character set provided the key uses the same number of possible values as the allowed number of characters in the set. Thus, for encrypting eight bit bytes which have 256 possible values, addition (or subtraction) in modulo 256 is used. When working with binary numbers where the number of possible values is a power of two, the encryption or decryption process can be executed very quickly using an exclusive-or operation to produce the same result as modulo addition or subtraction.
To encrypt a one megabyte computer file requires one megabyte of key that can not be reused. With the development of inexpensive CDs and DVDs to store a very long key, the use of one-time-pad encryption for computer communications has become practical.